package com.wanna.common.doc.util;

import java.lang.reflect.Field;
import java.util.stream.Stream;

/**
 * @author wanna
 * @since 2018-12-03
 */
public class ClassUtil {

    /**
     * 获取 类 的所有字段
     *
     * @param clazz class
     * @return fields
     */
    public static Field[] getDeclaredFields(Class clazz) {
        Field[] fields = clazz.getFields();
        Field[] declaredFields = clazz.getDeclaredFields();
        return Stream.concat(Stream.of(fields), Stream.of(declaredFields)).toArray(Field[]::new);
    }
}
